<template>
  <div class="my-temp">
    <div class="my-temp-list">
      <el-row
        class="my-temp-list-box"
        :gutter="34"
        type="flex"
        justify="space-around"
        style="flex-wrap: wrap"
      >
        <el-col
          class="my-produ-list-box-item"
          style="width: auto"
          v-for="item in lists"
          :key="item.id"
        >
          <div class="temp-item">
            <produ
              :key="'temp-' + item.site_id"
              :item="item"
              :produType="'ADMINTEMP'"
            ></produ>
          </div>
        </el-col>
        <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i>
      </el-row>
    </div>

    <el-pagination
      background
      layout="prev, pager, next"
      :current-page="curPage"
      :page-size="pageSize"
      :page-count="totalPage"
      @current-change="handleCurrentChange"
    >
    </el-pagination>
  </div>
</template>

<script>
import Produ from "@/views/child/admin/common/produ.vue";
import { useWebUserStore } from "@/store/web/user";
const useWebUser = useWebUserStore();
export default {
  setup() {
    return {
      curPage: 1,
      pageSize: 20,
    };
  },
  computed: {
    lists() {
      return useWebUser.myLists;
    },
    listsData() {
      return useWebUser.myListsData;
    },
    userid() {
      return useWebUser.userid;
    },
    totalPage() {
      return this.listsData?.totalPage || 0;
    },
  },
  components: {
    Produ,
  },
  beforeMount() {
    useWebUser.handleGetTempList({
      classfy_id: "",
      keywords: "",
      status: "",
      page: 1,
      pageSize: this.pageSize,
    });
  },
  methods: {
    handleCurrentChange(val) {
      this.curPage = val && !isNaN(val) ? val : 1;
      useWebUser.handleGetTempList({
        classfy_id: "",
        keywords: "",
        status: "",
        page: this.curPage,
        pageSize: this.pageSize,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/scss/admin-temp.scss";
</style>
